<template>
  <div style="position: relative">
    <div class="content">
      <div class="info">
        <div class="title">基本信息</div>
        <div class="list">
          <div class="item">
            <div class="tit">创建时间</div>
            <div class="desc">
              {{ detailList.gmtCreated ? detailList.gmtCreated : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">商户订单号</div>
            <div class="desc">
              {{ detailList.payformNo ? detailList.payformNo : "-" }}
            </div>
            <div
              v-if="detailList.payformNo"
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                @click="copyAppId(detailList.payformNo)"
              ></i>
            </div>
          </div>
          <div class="item">
            <div class="tit">云尘付流水号</div>
            <div class="desc">
              {{ detailList.innerPayformNo ? detailList.innerPayformNo : "-" }}
            </div>
            <div
              v-if="detailList.innerPayformNo"
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                @click="copyAppId(detailList.innerPayformNo)"
              ></i>
            </div>
          </div>
          <div class="item">
            <div class="tit">订单金额/元</div>
            <div class="desc">
              {{
                detailList.fmtOriginalAmount
                  ? detailList.fmtOriginalAmount
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">优惠金额/元</div>
            <div class="desc">
              {{
                detailList.fmtDiscountAmount
                  ? detailList.fmtDiscountAmount
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">应付金额/元</div>
            <div class="desc">
              {{
                detailList.fmtActualAmount ? detailList.fmtActualAmount : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">商品名称</div>
            <div class="desc">
              {{ detailList.subject ? detailList.subject : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">商品描述</div>
            <div class="desc">
              {{ detailList.subjectDesc ? detailList.subjectDesc : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">备注</div>
            <div class="desc">
              {{ detailList.description ? detailList.description : "-" }}
            </div>
          </div>
        </div>
      </div>
      <div class="info">
        <div class="title">支付信息</div>
        <div class="list">
          <div class="item">
            <div class="tit">支付状态</div>
            <div class="desc">
              {{ detailList.payStatusName ? detailList.payStatusName : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付时间</div>
            <div class="desc">
              {{ detailList.payTime ? detailList.payTime : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付渠道</div>
            <div class="desc">
              {{
                detailList.channelPayFormTypeName
                  ? detailList.channelPayFormTypeName
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">渠道流水号</div>
            <div class="desc">
              {{ detailList.thirdOrderNo ? detailList.thirdOrderNo : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付金额/元</div>
            <div class="desc">
              {{
                detailList.payStatus == "success_pay"
                  ? detailList.fmtActualAmount
                  : "-"
              }}
            </div>
          </div>

          <div class="item">
            <div class="tit">渠道手续费/元</div>
            <div class="desc">
              {{
                detailList.payStatus == "success_pay"
                  ? detailList.fmtFeeAmount
                  : "-"
              }}
            </div>
          </div>
        </div>
      </div>
      <div
        class="info"
        :style="{
          width: detailList.payformRefundResList
            ? detailList.payformRefundResList.length
              ? '800px'
              : ''
            : '',
        }"
      >
        <div class="title">退款信息</div>
        <div class="list">
          <div class="item">
            <div class="tit">退款情况</div>
            <div class="desc">
              {{
                detailList.refundStateName ? detailList.refundStateName : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">退款金额/元</div>
            <div class="desc">
              {{
                detailList.refundState != "no_refund"
                  ? detailList.fmtRefundAmount
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">退款手续费/元</div>
            <div class="desc">
              {{
                detailList.refundState != "no_refund"
                  ? detailList.fmtRefundFeeAmount
                  : "-"
              }}
            </div>
          </div>
        </div>
        <div
          style="margin-top: 20px"
          v-if="
            detailList.payformRefundResList
              ? detailList.payformRefundResList.length
                ? true
                : false
              : ''
          "
        >
          <tr class="openBox">
            <td>退款订单号</td>
            <td>退款状态</td>
            <td>退款金额/元</td>
            <td>退款时间</td>
          </tr>
          <div
            class="openBox1"
            v-for="(o, oIndex) in detailList.payformRefundResList"
            :key="oIndex"
          >
            <td :title="o.refundNo">
              {{ o.refundNo }}
            </td>
            <td :title="o.refundStatusName">
              {{ o.refundStatusName }}
            </td>
            <td :title="o.fmtRefundAmount">
              {{ o.fmtRefundAmount ? "￥" + o.fmtRefundAmount : "" }}
            </td>
            <td :title="o.gmtCreated">
              {{ o.gmtCreated }}
            </td>
          </div>
        </div>
      </div>
      <div
        class="info"
        :style="{
          width: detailList.payformSettleResList
            ? detailList.payformSettleResList.length
              ? '800px'
              : ''
            : '',
        }"
      >
        <div class="title">分账信息</div>
        <div class="list">
          <div class="item">
            <div class="tit">分账模式</div>
            <div class="desc">
              {{ detailList.settleModeName ? detailList.settleModeName : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">是否结算</div>
            <div class="desc">
              {{
                detailList.settleStatus == null
                  ? "-"
                  : detailList.settleStatus == 0
                  ? "否"
                  : "是"
              }}
            </div>
          </div>
          <div
            style="margin-top: 20px"
            v-if="
              detailList.payformSettleResList
                ? detailList.payformSettleResList.length
                  ? true
                  : false
                : ''
            "
          >
            <tr class="openBox">
              <!-- <td>分账时间</td> -->
              <td>分账接收方名称</td>
              <td>分账接收方ID</td>
              <td>分账金额/元</td>
            </tr>
            <div
              class="openBox1"
              v-for="(o, oIndex) in detailList.payformSettleResList"
              :key="oIndex"
            >
              <!-- <td :title="o.gmtCreated">
                {{ o.gmtCreated }}
              </td> -->
              <td :title="o.settleMemberName">
                {{ o.settleMemberName }}
              </td>
              <td :title="o.settleMemberNo">
                {{ o.settleMemberNo }}
              </td>
              <td :title="o.fmtSettleAmount">
                {{ o.fmtSettleAmount ? "￥" + o.fmtSettleAmount : "" }}
              </td>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="back" @click="backFn">
      <i class="el-icon-close"></i>
    </div>
    <div class="left">
      <el-breadcrumb separator=">" style="margin-bottom: 20px">
        <el-breadcrumb-item v-for="item of breadList" :key="item">{{
          item
        }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  </div>
</template>

<script>
export default {
  name: "salesOrderDetail",
  components: {},
  data() {
    return {
      detailList: {},
      breadList: [],
    };
  },
  created() {
    this.breadList = this.$route.meta.title;
    let id = this.$route.query.id;
    if (id) {
      this.$http.get(`/api/orderInfo/getById?id=${id}`).then((res) => {
        if (res.code === "0000") {
          this.detailList = res.data;
        }
      });
    }
  },
  methods: {
    backFn() {
      this.$backTo(`/deal/salesOrder`);
    },
    copyAppId(value) {
      const input = document.createElement("input"); // 创建input对象
      input.value = value; // 设置复制内容
      document.body.appendChild(input); // 添加临时实例
      input.select(); // 选择实例内容
      document.execCommand("Copy"); // 执行复制
      document.body.removeChild(input); // 删除临时实例
      this.$message.success("复制成功！");
    },
  },
};
</script>

<style scoped lang="scss">
.content {
  min-height: 780px;
  padding: 160px 100px;
  display: flex;
  justify-content: start;
  flex-wrap: wrap;
  .info {
    width: 33.3%;
    min-width: 500px;
    margin-bottom: 40px;
    padding: 0 2%;
    .title {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      padding-bottom: 15px;
      border-bottom: 1px solid #03bfc6;
    }
    .list {
      margin-top: 35px;
      .item {
        display: flex;
        .tit {
          min-width: 100px;
          margin-right: 32px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #869daa;
          line-height: 40px;
          text-align: right;
        }
        .desc {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #1d1c1c;
          line-height: 40px;
          overflow: hidden;
          word-wrap: break-word;
        }
      }
    }
    .openBox {
      margin-bottom: 20px;
      height: 22px;
      font-size: 15px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 600;
      color: #1d1c1c;
      line-height: 22px;
      display: flex;
      justify-content: start;
      td {
        display: inline-block;
        min-width: 22%;
        padding: 0 40px 0 0;
      }
    }
    .openBox1 {
      margin-bottom: 20px;
      height: 22px;
      font-size: 14px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      line-height: 22px;
      display: flex;
      justify-content: start;
      text-align: left;
      td {
        padding: 0 40px 0 0;
        min-width: 22%;
        width: 1px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
.back {
  position: absolute;
  right: 55px;
  top: 20px;
  font-size: 20px;
  cursor: pointer;
}
.left {
  position: absolute;
  left: 55px;
  top: 31px;
  height: 20px;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #869daa;
  line-height: 20px;
}
// :deep(.el-table__expand-icon) {
//   // position: absolute;
//   // left:140px;
//   float: left;
// }

@media screen and (max-width: 1770px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 520px;
      margin-bottom: 40px;
      padding: 0 5.5%;
    }
  }
}

@media screen and (max-width: 1550px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 488px;
      margin-bottom: 40px;
      padding: 0 2%;
    }
  }
}
</style>
